Imports NHibernate.Criterion
Imports NHibernate
Imports FrameworkNHibernate
Imports FrameworkNHibernate.Dal

Public Class ClienteDao
    Inherits GenericsNHibernateDao(Of Cliente)
    Implements IClienteDao


    Public Function BuscarPorNome(ByVal _nome As String) As IList(Of Cliente) Implements IClienteDao.BuscarPorNome

        Dim _criterio As ICriteria = MyBase.CurrentSession.CreateCriteria(GetType(Cliente))

        _criterio.Add(Expression.Like("Nome", _nome))

        Return _criterio.List(Of Cliente)()

    End Function

    Public Function BuscarPorCPF(ByVal _cpf As String) As IList(Of Cliente) Implements IClienteDao.BuscarPorCPF

        Dim _criterio As ICriteria = MyBase.CurrentSession.CreateCriteria(GetType(Cliente))

        _criterio.Add(Expression.Eq("CPF", _cpf))

        Return _criterio.List(Of Cliente)()

    End Function

    Public Function BuscarPorRG(ByVal _rg As String) As IList(Of Cliente) Implements IClienteDao.BuscarPorRG

        Dim _criterio As ICriteria = MyBase.CurrentSession.CreateCriteria(GetType(Cliente))

        _criterio.Add(Expression.Eq("RG", _rg))

        Return _criterio.List(Of Cliente)()

    End Function

End Class